package com.adx.encrypt.starter.utils;

public class AjaxResult {
    private String code;
    private String msg;
    private Object data;

    public static AjaxResult build() {
        return new AjaxResult();
    }

    public static AjaxResult ok(String msg) {
        return new AjaxResult("200", msg, null);
    }


    public static AjaxResult ok(String msg, Object data) {
        return new AjaxResult("200", msg, data);
    }

    public static AjaxResult error(String msg) {
        return new AjaxResult("500", msg, null);
    }

    public static AjaxResult error(String msg, Object data) {
        return new AjaxResult("500", msg, data);
    }

    private AjaxResult() {
    }

    private AjaxResult(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public String getcode() {
        return code;
    }

    public AjaxResult setcode(String code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Object getdata() {
        return data;
    }

    public AjaxResult setdata(Object data) {
        this.data = data;
        return this;
    }
}
